﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.UI;

namespace BLL.sysmanager
{
    public class ProductCategoryService
    {
        ManagePage mym = new ManagePage();

        public bool AddProductCategory(Page page, ps_user_groups model)
        {
            if (model.Exists(model.title))
            {
                mym.JscriptMsg(page, "您输入的会员级别名称已经存在，请检查！", "", "Error");
                return false;
            }

            if (model.Add() > 0)
            {
                //mym.AddAdminLog("增加", "添加会员级别：" + model.title); //记录日志
                return true;
            }

            return false;
        }

        public bool UpdateProductCategory(Page page, int _id, ps_user_groups model)
        {
            bool result = false;

            if (model.Exists(model.title, _id))
            {
                //mym.JscriptMsg(page, "您输入的会员级别名称已经存在，请检查！", "", "Error");
                return false;
            }
            model.GetModel(_id);



            if (model.Update())
            {
                //mym.AddAdminLog("修改", "修改会员级别:" + model.title); //记录日志
                result = true;
            }

            return result;
        }
    }
}
